Skip to content

fix: resolve all failing tests and type errors across monorepo - #104

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2301-1785624453
Open

fix: resolve all failing tests and type errors across monorepo#104
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2301-1785624453

Conversation

@stooit

@stooit stooit commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 5 failing tests and eliminates all TypeScript errors across the packages/ui, packages/utils, and apps/web workspaces. bun run test → 13 pass / 0 fail and tsc --noEmit → clean.

Root causes & fixes

Package File Bug Fix
utils→web apps/web/src/lib/api.ts Imported/re-exported the old hook name useThrottle, which no longer exists (TS2305) Point the import + re-export at the real export useDebounce; the app-facing useSearchDebounce alias is preserved
ui packages/ui/src/components/Button/Button.tsx aria-label was declared in Props but never applied, so icon-only buttons had no accessible name Apply aria-label with a fallback for iconOnly, plus a dev-only warning when an icon-only button is unlabelled (WCAG 2.2 SC 4.1.2)
ui packages/ui/src/components/DataTable/DataTable.tsx Sort-direction toggle read stale state in its closure (caught by the controlled re-render test) Use functional setSortDir(prev => …)
utils packages/utils/src/format/date.ts formatDate zero-padded the day (01/03/2024), failing the /^1/ assertion Emit day-first D/MM/YYYY with no leading zero on the day
build tsconfig.json bun:test unresolved under tsc (4× TS2307) Add "types": ["bun-types"] (already a devDependency)

Verification

$ bun run test   → 13 pass / 0 fail
$ tsc --noEmit   → 0 errors

Constraints honoured

  • No test files modified.
  • No dependencies added (bun-types was already a devDependency).
  • Each edit maps to a specific failing test / type error.

Assumptions & notes for reviewers

  • The real defect in formatDate was day zero-padding, not field order — the original already emitted day-first. The fix targets the padding only.
  • The Button aria-label prop now also flows through to text buttons (previously inert). No test exercises that path; flagged as a WCAG 2.5.3 follow-up, not changed here since no test requires it.
  • Pre-existing, out of scope (no regression, not test-required): formatDate has no timeZone option so it renders in system TZ; and DataTable's sort control is a click handler on a non-focusable <th> (keyboard operability, WCAG 2.1.1). Both worth follow-up tickets.

Investigation plan retained at docs/plans/2026-08-01-fix-5-failing-tests-and-tsc-error.md.

- api.ts: correct renamed hook import (useThrottle -> useDebounce)
- Button: apply aria-label for iconOnly buttons + dev-only warning (WCAG 4.1.2)
- DataTable: fix stale-closure in sort toggle via functional setState
- date.ts: formatDate emits day-first D/MM/YYYY without day zero-padding
- tsconfig: load bun-types so bun:test resolves under tsc

All 13 tests pass; tsc --noEmit is clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant